﻿using System;
using System.Net;
using Argos.Activities.MessageDelivery;
using Argos.Activities.Tests;
using Argos.Data.Model;
using Argos.Workflows;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.ComponentModel.Design.Serialization;
using System.Xml;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using Argos.Net;

namespace Argos.Core.Tests
{
	[TestClass]
	public class ModelTests
	{

		#region public TestContext TestContext { get; set; }

		private TestContext testContextInstance;

		/// <summary>
		///Gets or sets the test context which provides
		///information about and functionality for the current test run.
		///</summary>
		public TestContext TestContext
		{
			get
			{
				return testContextInstance;
			}
			set
			{
				testContextInstance = value;
			}
		}

		#endregion



		#region Test: public void CompareRoute01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareRoute01()
		{
			MessageDeliveryRoute route1 = new MessageDeliveryRoute() { Name = "Route 1" };
			MessageDeliveryRoute route2 = new MessageDeliveryRoute() { Name = "Route 1", Id = route1.Id };

			Assert.AreEqual<MessageDeliveryRoute>(route1, route2);
		}

		#endregion

		#region Test: public void CompareRoute02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareRoute02()
		{
			MessageDeliveryRoute route1 = new MessageDeliveryRoute() { Name = "Route 1" };
			MessageDeliveryRoute route2 = new MessageDeliveryRoute() { Name = "Route 1" };

			Assert.AreNotEqual<MessageDeliveryRoute>(route1, route2);
		}

		#endregion

		#region Test: public void CompareRoute03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareRoute03()
		{
			MessageDeliveryRoute route1 = new MessageDeliveryRoute() { Name = "Route 66" };
			route1.DeliveryActivityProperties["Prop1"] = true;
			MessageDeliveryRoute route2 = new MessageDeliveryRoute() { Name = route1.Name, Id = route1.Id };
			route2.DeliveryActivityProperties["Prop1"] = false;

			Assert.AreNotEqual<MessageDeliveryRoute>(route1, route2);
		}

		#endregion
		


		#region Test: public void CompareTarget01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTarget01()
		{
			Target t1 = new Target();
			Target t2 = new Target();

			t1.MonitoringWorkflowProperties["LeKey"] = "LeValue";
			t2.Id = t1.Id;
			t2.Test.Id = t1.Test.Id;

			Assert.AreNotEqual<Target>(t1, t2);
		}

		#endregion

		#region Test: public void CompareTarget02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTarget02()
		{
			Target t1 = new Target();
			Target t2 = new Target();

			t2.Id = t1.Id;
			t2.Test.Id = t1.Test.Id;
			t1.MonitoringWorkflowProperties["Diipa"] = "Daapa";
			t2.MonitoringWorkflowProperties["Diipa"] = "Daapa";

			Assert.AreEqual<Target>(t1, t2);
		}

		#endregion
		


		#region Test: public void CompareTest01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTest01()
		{
			Test t1 = new Test();
			Test t2 = new Test();
			t2.Id = t1.Id;

			Assert.AreEqual<Test>(t1, t2);
		}

		#endregion

		#region Test: public void CompareTest02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTest02()
		{
			Test t1 = new Test();
			t1.ActivityType = typeof(PingTestActivity);

			t1.ActivityProperties.Add("Host", "localhost");
			t1.ActivityProperties.Add("Timeout", (uint)100);

			Test t2 = new Test();
			t2.Id = t1.Id;
			t2.ActivityType = typeof(PingTestActivity);
			t2.ActivityProperties.Add("Host", "localhost");
			t2.ActivityProperties.Add("Timeout", (uint)100);

			Assert.AreEqual<Test>(t1, t2);
		}

		#endregion



		#region Test: public void CreateRecipient01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateRecipient01()
		{
			Recipient r = new Recipient();
			Assert.AreNotEqual<Guid>(Guid.Empty, r.Id);
		}

		#endregion



		#region Test: public void CreateRoute01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		[ExpectedException(typeof(ArgumentException))]
		public void CreateRoute01()
		{
			MessageDeliveryRoute route = new MessageDeliveryRoute();
			route.DeliveryActivityType = typeof(string);
		}

		#endregion

		#region Test: public void CreateRoute02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		[ExpectedException(typeof(ArgumentNullException))]
		public void CreateRoute02()
		{
			MessageDeliveryRoute route = new MessageDeliveryRoute();
			route.DeliveryActivityType = null;
		}

		#endregion
		


		#region Test: public void CreateTarget01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTarget01()
		{
			Target t = new Target();
			Assert.AreNotEqual<Guid>(Guid.Empty, t.Id);
		}

		#endregion

		#region Test: public void CreateTarget02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTarget02()
		{
			Target t = new Target();
			Assert.IsTrue(t.Enabled);
			Assert.AreEqual<TimeSpan>(TimeSpan.FromSeconds(5), t.Test.ExecutionTimeout);
			Assert.AreEqual<TimeSpan>(TimeSpan.FromSeconds(30), t.TestExecutionInterval);
		}

		#endregion
		


		#region Test: public void CreateTargetGroup01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTargetGroup01()
		{
			TargetGroup tg = new TargetGroup();
			Assert.AreNotEqual<Guid>(Guid.Empty, tg.Id);
		}

		#endregion
		


		#region Test: public void DeserializeTarget01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeTarget01()
		{
			Target t1 = new Target();
			t1.Enabled = false;
			t1.MonitoringWorkflowType = typeof(TargetFailureMonitoringWorkflow);
			t1.Description = "The Description";
			t1.Name = "Le Name";
			t1.Test.ActivityType = typeof(PingTestActivity);
			t1.TestExecutionInterval = TimeSpan.FromSeconds(4);

			Target t2 = null;

			BinaryFormatter f = new BinaryFormatter();

			using (MemoryStream strm = new MemoryStream())
			{
				f.Serialize(strm, t1);
				strm.Position = 0;
				t2 = (Target)f.Deserialize(strm);
			}

			Assert.AreEqual<bool>(false, t2.Enabled);
			Assert.AreEqual<Type>(typeof(TargetFailureMonitoringWorkflow), t2.MonitoringWorkflowType);
			Assert.AreEqual<string>("The Description", t2.Description);
			Assert.AreEqual<Guid>(t1.Id, t2.Id);
			Assert.AreEqual<string>("Le Name", t2.Name);
			Assert.AreEqual<Test>(t1.Test, t2.Test);
			Assert.AreEqual<TimeSpan>(TimeSpan.FromSeconds(4), t2.TestExecutionInterval);

		}

		#endregion

		#region Test: public void DeserializeTarget02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeTarget02()
		{
			Target t1 = new Target();
			t1.Description = "Le description";
			t1.MonitoringWorkflowType = typeof(TargetFailureMonitoringWorkflow);
			t1.Name = "Le targét";
			t1.Test.ActivityType = typeof(PingTestActivity);
			t1.Test.ActivityProperties["Host"] = "localhost";
			t1.TestExecutionInterval = TimeSpan.FromSeconds(20);

			Target t2 = null;
			using (MemoryStream strm = new MemoryStream())
			{
				t1.WriteXml(strm);
				strm.Position = 0;
				t2 = Target.ReadXml(strm);
			}

			Assert.AreEqual<Target>(t1, t2);
		}

		#endregion

		#region Test: public void DeserializeTarget03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeTarget03()
		{
			Target t1 = new Target();
			t1.Enabled = false;
			t1.Name = "lklkjlkjlkjlkj";

			Target t2 = null;

			using (MemoryStream strm = new MemoryStream())
			{
				t1.WriteXml(strm);
				strm.Position = 0;
				t2 = Target.ReadXml(strm);
			}

			Assert.AreEqual<Target>(t1, t2);
		}

		#endregion

		#region Test: public void DeserializeTarget04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeTarget04()
		{
			Target t1 = new Target();
			t1.MonitoringWorkflowType = typeof(TargetFailureMonitoringWorkflow);
			t1.MonitoringWorkflowProperties["AlertFailureThreshold"] = 10;

			Target t2 = null;

			using (MemoryStream strm = new MemoryStream())
			{
				t1.WriteXml(strm);
				strm.Position = 0;
				t2 = Target.ReadXml(strm);
			}

			Assert.AreEqual<Target>(t1, t2);
		}

		#endregion
		


		#region Test: public void DeserializeTest01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeTest01()
		{
			Test t1 = new Test();
			t1.ActivityType = typeof(HttpTestActivity);

			Test t2 = null;
			using (MemoryStream strm = new MemoryStream())
			{
				t1.WriteXml(strm);
				strm.Position = 0;
				t2 = Test.ReadXml(strm);
			}

			Assert.AreEqual<Test>(t1, t2);
		}

		#endregion

		#region Test: public void DeserializeTest02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeTest02()
		{
			Test t1 = new Test();
			t1.ActivityType = typeof(HttpTestActivity);
			t1.ActivityProperties["Item1"] = "value1";
			t1.ActivityProperties["Item2"] = "value2";
			t1.ExecutionTimeout = TimeSpan.FromMilliseconds(500);

			Test t2 = null;
			using (MemoryStream strm = new MemoryStream())
			{
				t1.WriteXml(strm);
				strm.Position = 0;
				t2 = Test.ReadXml(strm);
			}

			Assert.AreEqual<Test>(t1, t2);
		}

		#endregion

		#region Test: public void DeserializeTest03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeTest03()
		{
			Test t1 = new Test();
			t1.ActivityType = typeof(PingTestActivity);
			t1.ActivityProperties["ExpectedStatus"] = IPStatus.Success;
			t1.ActivityProperties["Host"] = "localhost";

			Test t2 = null;

			using (MemoryStream strm = new MemoryStream())
			{
				t1.WriteXml(strm);
				strm.Position = 0;
				t2 = Test.ReadXml(strm);
			}


			Assert.AreEqual<Test>(t1, t2);
		}

		#endregion

		#region Test: public void DeserializeTest04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeTest04()
		{
			Test t1 = new Test();
			t1.ActivityType = typeof(HttpStatusTestActivity);
			t1.ActivityProperties["Url"] = new Uri("http://www.tietoenator.com");
			t1.ActivityProperties["NetworkCredentials"] = new Credential("username", "password", "domain");

			Test t2 = null;
			using(MemoryStream strm = new MemoryStream())
			{
				t1.WriteXml(strm);
				strm.Position = 0;
				t2 = Test.ReadXml(strm);
			}

			Assert.AreEqual<Test>(t1, t2);
		}

		#endregion

		#region Test: public void DeserializeTest05()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeTest05()
		{
			Test t1 = new Test();
			t1.ActivityProperties["Url"] = new Uri("http://www.codeplex.com");
			t1.ActivityProperties["Credentials"] = new Credential("username", "password", "domain");
			t1.ActivityProperties["id"] = Guid.NewGuid();
			t1.ActivityProperties["utcDate"] = DateTime.Parse("2001-01-01 05:25:30").ToUniversalTime();
			t1.ActivityProperties["localDate"] = DateTime.Parse("2008-06-30 16:45:24").ToLocalTime();
			t1.ActivityProperties["YesOrNo"] = false;
			t1.ActivityProperties["StringType"] = typeof(string);
			t1.ActivityProperties["LeString"] = "lakjsdlkfjlakjsdlkjflkjlkjlkj";
			t1.ActivityProperties["WhatDay"] = DayOfWeek.Friday;
			t1.ActivityProperties["Interval"] = TimeSpan.FromSeconds(3621);

			Test t2 = null;
			string xml = null;
			using (MemoryStream strm = new MemoryStream())
			{
				t1.WriteXml(strm);
				strm.Position = 0;

				using (StreamReader reader = new StreamReader(strm))
				{
					xml = reader.ReadToEnd();
					strm.Position = 0;
					t2 = Test.ReadXml(strm);
				}
			}
			XmlDocument doc = new XmlDocument();
			doc.LoadXml(xml);

			Assert.AreEqual<string>("test", doc.DocumentElement.LocalName);
			Assert.AreEqual<string>(ItemBase.XmlNamespace, doc.DocumentElement.NamespaceURI);
			Assert.AreEqual<Test>(t1, t2);
		}

		#endregion
		


		#region Test: public void SerializeMonitoringHost01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeMonitoringHost01()
		{
			MonitoringHost host = new MonitoringHost();
			host.Address = IPAddress.Parse("1.1.1.1");
			host.HostName = "localhost";
			host.LastHeartBeat = DateTime.UtcNow;

			byte[] buffer = host.ToByteArray();
			Assert.IsNotNull(buffer);
			Assert.AreNotEqual<int>(0, buffer.Length);
		}

		#endregion



		#region Test: public void SerializeRecipient01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeRecipient01()
		{
			Recipient r = new Recipient();
			r.Address = "john.doe@inter.net";
			r.Name = "John Doe";
			r.DeliveryRoute.DeliveryActivityType = typeof(EmailDeliveryActivity);

			byte[] buffer = r.ToByteArray();
			Assert.IsNotNull(buffer);
			Assert.AreNotEqual<int>(0, buffer.Length);
		}

		#endregion



		#region Test: public void SerializeRecipientGroup01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeRecipientGroup01()
		{
			RecipientGroup r = new RecipientGroup();
			r.Description = "Le Descriptión";
			r.Name = "Le Námê";
			r.Members.Add(new Recipient());

			byte[] buffer = r.ToByteArray();
			Assert.IsNotNull(buffer);
			Assert.AreNotEqual<int>(0, buffer.Length);
		}

		#endregion



		#region Test: public void SerializeRoute01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeRoute01()
		{
			MessageDeliveryRoute route1 = new MessageDeliveryRoute();
			route1.Name = "Route 1";
			route1.DeliveryActivityType = typeof(EmailDeliveryActivity);
			route1.DeliveryActivityProperties.Add("Property1", "Value1");
			route1.DeliveryActivityProperties.Add("Property2", true);

			string xml = route1.ToXmlString();
			MessageDeliveryRoute route2 = null;
			using (MemoryStream strm = new MemoryStream())
			{
				using (StreamWriter writer = new StreamWriter(strm))
				{
					writer.Write(xml);
					writer.Flush();

					strm.Position = 0;
					route2 = MessageDeliveryRoute.ReadXml(strm);
				}
			}

			Assert.AreEqual<MessageDeliveryRoute>(route1, route2);
		}

		#endregion
		


		#region Test: public void SerializeTarget01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeTarget01()
		{
			Target t = new Target();
			t.MonitoringWorkflowType = typeof(TargetFailureMonitoringWorkflow);
			t.Name = "The Name";
			t.Test.ActivityType = typeof(HttpStatusTestActivity);
			t.Test.ExecutionTimeout = TimeSpan.FromMilliseconds(10000);

			byte[] buffer = t.ToByteArray();
			Assert.IsNotNull(buffer);
			Assert.AreNotEqual<int>(0, buffer.Length);
		}

		#endregion

		#region Test: public void SerializeTarget02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeTarget02()
		{
			Target t = new Target();
			t.MonitoringWorkflowType = typeof(TargetFailureMonitoringWorkflow);
			t.Name = "The Name";
			t.Test.ActivityType = typeof(HttpStatusTestActivity);
			t.Test.ExecutionTimeout = TimeSpan.FromMilliseconds(10000);

			byte[] buffer = t.ToByteArray();
			Assert.IsNotNull(buffer);
			Assert.AreNotEqual<int>(0, buffer.Length);
		}

		#endregion

		#region Test: public void SerializeTarget03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeTarget03()
		{
			Target t = new Target();

			t.Description = "Le description";
			t.Enabled = false;
			t.MonitoringWorkflowType = typeof(TargetFailureMonitoringWorkflow);
			t.MonitoringWorkflowProperties.Add("AlertFailureThreshold", (uint)3);
			t.Name = "PING!";
			t.Test.ActivityType = typeof(PingTestActivity);
			t.Test.ActivityProperties.Add("Host", "localhost");

			string s = t.ToXmlString();
			XmlDocument doc = new XmlDocument();
			doc.LoadXml(s);

			Assert.AreEqual<string>("target", doc.DocumentElement.LocalName);
		}

		#endregion
		


		#region Test: public void SerializeTargetGroup01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeTargetGroup01()
		{
			TargetGroup t = new TargetGroup();
			t.Name = "Le Groupê";
			t.Host = new MonitoringHost();
			
			byte[] buffer = t.ToByteArray();
			Assert.IsNotNull(buffer);
			Assert.AreNotEqual<int>(0, buffer.Length);
		}

		#endregion



		#region Test: public void SerializeTest01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeTest01()
		{
			Test t1 = new Test();
			Test t2 = null;
			t1.ActivityType = typeof(PingTestActivity);
			t1.ActivityProperties.Add("Host", "localhost");
			t1.ActivityProperties.Add("Timeout", (uint)100);


			BinaryFormatter bf = new BinaryFormatter();
			using (MemoryStream strm = new MemoryStream())
			{
				bf.Serialize(strm, t1);
				strm.Position = 0;

				t2 = (Test)bf.Deserialize(strm);
			}

			Assert.AreEqual(t1, t2);
		}

		#endregion

		#region Test: public void SerializeTest02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeTest02()
		{
			Test t1 = new Test();
			Test t2 = null;

			t1.ActivityType = typeof(WebPageContentTestActivity);
			t1.ActivityProperties.Add("ExpectedContent", "This content is expected");

			t2 = (Test)t1.Clone();
			Assert.AreEqual<Test>(t1, t2);
		}

		#endregion

		#region Test: public void SerializeTest03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeTest03()
		{
			Test t1 = new Test();
			Test t2 = (Test)t1.Clone();

			Assert.AreEqual<Guid>(t1.Id, t2.Id);
		}

		#endregion

		#region Test: public void SerializeTest04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeTest04()
		{
			Test t1 = new Test();
			t1.ActivityType = typeof(PingTestActivity);
			Test t2 = (Test)t1.Clone();

			Assert.AreNotSame(t1, t2);
			Assert.AreEqual<Guid>(t1.Id, t2.Id);
			Assert.AreEqual<Type>(t1.ActivityType, t2.ActivityType);
		}

		#endregion

		#region Test: public void SerializeTest05()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeTest05()
		{
			Test t = new Test();

			t.ActivityType = typeof(WebPageContentTestActivity);
			t.ActivityProperties.Add("Url", new Uri("http://www.codeplex.com"));
			t.ActivityProperties.Add("FollowRedirection", false);
			t.ExecutionTimeout = TimeSpan.FromMilliseconds(50);

			string xml = t.ToXmlString();
			XmlDocument doc = new XmlDocument();
			doc.LoadXml(xml);

			Assert.AreEqual<string>("test", doc.DocumentElement.Name);
			Assert.AreEqual<string>(ItemBase.XmlNamespace, doc.DocumentElement.NamespaceURI);
		}

		#endregion
		
		
	}
}
